package com.sms.service.impl;

import com.sms.mapper.DepartmentMapper;
import com.sms.pojo.Department;
import com.sms.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;

import java.util.List;

@Service
@Validated
public class DepartmentServiceImpl implements DepartmentService {

    @Autowired
    private DepartmentMapper departmentMapper;

    public void setDepartmentMapper(DepartmentMapper departmentMapper) {
        this.departmentMapper = departmentMapper;
    }

    @Override
    public List<Department> getDepartments() {
        return departmentMapper.getDepartments();
    }

    @Override
    public Department getDepatmentById(Integer id) {
        return departmentMapper.getDepatmentById(id);
    }

    @Override
    public Department getDepatmentByName(String name) {
        return departmentMapper.getDepatmentByName(name);
    }
}
